package vn.nt.healthcare.server.ws.repositories;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import vn.nt.healthcare.server.ws.domain.AppUser;

public interface AppUserRepository extends JpaRepository<AppUser, Integer> {

	@Query("SELECT DISTINCT(au.token) FROM AppUser au WHERE 1 =1 ")
	List<String> findDevices();

	@Query("SELECT (a.token) FROM AppUser a WHERE a.app_name = :appName AND a.os = :os")
	List<String> getTokenByAppNameAndOs(@Param("appName") String appName,
			@Param("os") String os);
}
